/**
 * amis v6.13.0
 * build time: 2025-08-12
 * Copyright 2018-2025 baidu
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _Icon = require('amis-ui/lib/components/Icon');
var tslib = require('tslib');
var React = require('react');
var amisCore = require('amis-core');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _Icon__default = /*#__PURE__*/_interopDefaultLegacy(_Icon);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

var __react_jsx__ = require('react');
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
var _J$F_ = (__react_jsx__["default"] || __react_jsx__).Fragment;


;var PasswordField = /** @class */function (_super) {
  tslib.__extends(PasswordField, _super);
  function PasswordField() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.state = {
      visible: false
    };
    return _this;
  }
  PasswordField.prototype.toggleVisible = function () {
    this.setState({
      visible: !this.state.visible
    });
  };
  PasswordField.prototype.render = function () {
    var _a = this.props,
      cx = _a.classnames,
      className = _a.className,
      style = _a.style,
      _b = _a.mosaicText,
      mosaicText = _b === void 0 ? '********' : _b,
      value = _a.value;
    return _J$X_("span", {
      className: cx('Password-field', className),
      style: style
    }, this.state.visible ? value : mosaicText, this.state.visible ? _J$X_(_Icon__default["default"], {
      icon: "view",
      className: "icon",
      onClick: this.toggleVisible
    }) : _J$X_(_Icon__default["default"], {
      icon: "invisible",
      className: "icon",
      onClick: this.toggleVisible
    }));
  };
  tslib.__decorate([amisCore.autobind, tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", void 0)], PasswordField.prototype, "toggleVisible", null);
  return PasswordField;
}(React__default["default"].Component);
var PasswordFieldRenderer = /** @class */function (_super) {
  tslib.__extends(PasswordFieldRenderer, _super);
  function PasswordFieldRenderer() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  PasswordFieldRenderer = tslib.__decorate([amisCore.Renderer({
    type: 'password'
  })], PasswordFieldRenderer);
  return PasswordFieldRenderer;
}(PasswordField);

exports.PasswordField = PasswordField;
exports.PasswordFieldRenderer = PasswordFieldRenderer;
